from game.models import UserRecord, PlatformRecord
from rest_framework import serializers

class UserRecordSerializer(serializers.ModelSerializer):
    """
    用户记录序列化
    """
    status = serializers.CharField(source='get_status_display')
    isbigs = serializers.CharField(source='platrecord.get_isbigs_display')
    small_big = serializers.CharField(source='get_small_big_display')
    iswining = serializers.CharField(source='get_iswining_display')
    nper = serializers.CharField(source='platrecord.nper')


    class Meta:
        model = UserRecord
        fields = ['token','small_big','iswining','count','beton','payoff','nper','status','isbigs','add_time']

class PlatformRecordSerializer(serializers.ModelSerializer):
    """
   平台记录序列化
    """
    isbigs = serializers.CharField(source='get_isbigs_display')
    class Meta:
        model = PlatformRecord
        fields = ['nper','isbigs','num','add_time']
        # fields = '__al__'


